<?php

namespace App\Http\Middleware;

use App\Http\Controllers\Api\Service\LoginService;
use Closure;
use Illuminate\Auth\Events\Login;

class AdminOuth
{
    /**
     * 运行请求过滤器
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $res=LoginService::isLogin($request);

        if(!$res){
            return response(error(null,'认证失败'),401);
        }

        return $next($request);
    }

}